#pragma once
#include"HashTable.h"
using namespace wzy;
namespace wzy2
{
	template<class K, class Set = Setof<K>>
	class set
	{
		typedef HashNode<K> Node;

	public:
		

		struct getkey
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};

		

		bool Insert(const K & key)
		{
			return hash.Insert(key);
		}

		bool Erase(const K& key)
		{
			return hash.Erase(key);
		}

		typedef typename HashTable<K, K, getkey, Set>::const_iterator iterator;
		typedef typename HashTable<K, K, getkey, Set>::const_iterator const_iterator;



		//iterator begin()
		//{
		//	return hash.begin();
		//}

		//iterator end()
		//{
		//	return hash.end();
		//}

		const_iterator begin() const
		{
			return hash.begin();
		}

		const_iterator end() const
		{
			return hash.end();
		}

		void Print()
		{
			for (size_t i = 0; i < hash._tables.size(); i++)
			{
				cout << i << "->";
				Node* cur = hash._tables[i];
				while (cur)
				{
					cout << cur->_data << "  ";
					cur = cur->_next;
				}
				cout << endl;
			}
			cout << hash._tables.size()<<endl;
		}

	private:
		HashTable<K, K, getkey,Set> hash;
	};
}